/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package embeddedpaint.user_interface.tools.dialog.chooser;

import embeddedpaint.user_interface.tools.dialog.chooser.MyFileChooser;
import java.io.File;
import javax.swing.filechooser.FileFilter;

public class MyFilechooserLoader extends MyFileChooser
{
    public MyFilechooserLoader ()
    {
        this.setfilter();
    }
    
    private void setfilter ()
    {   
        this.setFileFilter(new FileFilter()
        {
            @Override
            public boolean accept (File f)
            {
                if (f.isDirectory())
                {
                    return true;
                }
                if (f.getName().endsWith(".jpg"))
                {
                    return true;
                }
                if (f.getName().endsWith(".gif"))
                {
                    return true;
                }
                if (f.getName().endsWith(".png"))
                {
                    return true;
                }
                return false;
            }

            @Override
            public String getDescription ()
            {
                return "*.jpg, *.gif, *.png";
            }
        });
    }
}
